package com.lx.constant;

import com.lx.entity.Result;

public enum DefaultResult {
    OK(200, "成功"),
    ERROR(500, "错误"),
    TOKERPAST(401, "token过期"),
    ACCESSERROR(403, "权限不足"),
    RESULT_SERVICE_ERR(500, "自定义业务异常"),
    SERVICE_ERR(501, "业务异常"),
    VIOLATION_ERR(502, "参数验证异常"),
    MISS_ERR(503, "缺少参数异常"),
    PARS_ERR(504, "参数解析异常"),
    NO_HADNLER_ERR(505, "接口不存在"),
    CALL_LIMIT(506, "接口调用次数到达上限"),
    VERSION_ERR(507, "客户端与服务版本不一致"),
    IP_LIMIT(508,"IP访问受限"),
    REMOTEERROR(509, "远程调用失败"),
    LOGINERROR(510, "用户名或密码错误"),
    REPERROR(512, "重复操作"),
    RESPONSE_ERROR(600, "输出信息异常")
    ;
    private String message;
    private Integer code;
    private Object data;

    DefaultResult(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Result getResult() {
        return Result.err(this.code, this.message);
    }

    public Result setMessage(String message) {
        return Result.err(this.code, message);
    }

    public Result setData(Object data) {
        return new Result(this.code, this.message, data);
    }
}